<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <#assign base=request.contextPath  />
    <link rel="stylesheet" href="${base}/js/layui/css/layui.css?t=1534970980648" media="all">
    <script type="text/javascript" src="${base}/js/zhang.js"></script>
    <script src="${base}/js/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="${base}/js/ztree/jquery-1.4.4.min.js"></script>
    <script src="${base}/js/jquery.min.js"></script>

    <style type="text/css">
		form{
		  padding:20px;
		}
		.layui-btn-radius{
                 border-radius: 5px;
                }
		</style>
</head>
<body>
<form class="layui-form" action="">
    <div class="layui-form-item">
    	<input type="hidden" id="workId"/>
  		<div class="layui-inline">
            <label class="layui-form-label"><a style="color:red">*</a>&nbsp;房间号</label>
            <div class="layui-input-block">
            <select name="city" lay-verify="required" lay-search="" class=" isNull" id="roomId">
                <option value=""></option>
			</select>
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;护士</label>
            <div class="layui-input-inline">
                <input name="number" id="beonduty" lay-verify="required" autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>




        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;联系电话</label>
            <div class="layui-input-inline">
                <input name="number" id="contactnumber" lay-verify="required|number|phone" autocomplete="off" class="layui-input isNull isPhone" type="text">
            </div>
        </div>

         <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">备注</label>
                    <div class="layui-input-block">
                      <textarea placeholder="请输入内容" id="remarks" class="layui-textarea"></textarea>
                    </div>
                  </div>
         <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-radius" lay-submit=""  type="button" onclick="Worksbmint()" lay-filter=""style="background-color: #0092EF;">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-radius">重置</button>
        </div>
    </div>

    </div>
</form>

<script>
layui.use(['form', 'layedit', 'laydate','layer'], function(){
  var form = layui.form
  ,layer = layui.layer
  ,layedit = layui.layedit
  ,laydate = layui.laydate;
 laydate.render({
    elem: '#test5'
    ,type: 'datetime'
  });
 });
function Worksbmint(){

if(!isPhone()){
return;
}
var remark;
if($("#remarks").val()==null||$("#remarks").val()==""){
remark=" ";
}else{
remark=$("#remarks").val();
}

  var jsonDate={};
  //转变时间戳
  var da=new Date($("#test5").val());
     jsonDate.home_id= $("#home_id").val();
      jsonDate.time= da.getTime();
                //属性id     文本框id
       jsonDate.roomId= $("#roomId").val();
        jsonDate.dutyrecord =$("#dutyrecord").val();
          jsonDate.contactnumber =$("#contactnumber").val();
           jsonDate.remarks =remark;
           jsonDate.id =$("#workId").val();
               jsonDate.beonduty= $("#beonduty").val();
          if(!isNull()){
          return;
          }
 var ID =$("#workId").val();
      if(!isNull()){
      return;
      }
    $.ajax({
    type:"POST",
                      url:"${base}/workguidace/updateWorkguidace",
                      data:{"param":JSON.stringify(jsonDate)},
                      success : function(data){

              layer.msg(data);

setTimeout(function(){
   var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
          parent.layer.close(index); //再执行关闭
},500)
                 //   文本框id
            jsonDate.home_id= $("#home_id").val("");
                     jsonDate.beonduty= $("#beonduty").val("");
                    jsonDate.roomId= $("#roomId").val("");
                  jsonDate.dutyrecord =$("#dutyrecord").val("");
                   jsonDate.contactnumber =$("#contactnumber").val("");
                   jsonDate.remarks =$("#remarks").val("");
                 var table = parent.layui.table;
                    //表刷新方法
                      table.reload('testReload', {
                        url: '${base}/workguidace/selectWorkguidace'
                            ,where: {} //设定异步数据接口的额外参数
                             //,height: 300
                           });
          }
    })
 }

//获取添加时候的房间id
var bas = "${base}"
//home:变量  = zhang.js里边封装的名称(路径,"字典表里边的code")
var home_data = getDataByDicCode(bas,"home")
for(var i=0;i<home_data.length;i++){

$("#roomId").append(
    ' <option value="'+home_data[i].id+'">'+home_data[i].name+'</option>'
)

}





</script>
</body>
</html>
